package cn.epsilon3.page;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 分页参数
 *
 * @author epsilon3
 * @date 2023/07/17
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class PageRequestParam extends PageParam {

    /**
     * 分页参数合理化
     */
    @ApiModelProperty(value = "分页参数合理化",example = "true")
    private boolean reasonable = true;

    /**
     * 查询总数优化
     */
    @ApiModelProperty(value = "查询总数优化",example = "true")
    private boolean countOptimize = true;

    private static PageRequestParam of(int pageNumber, int pageSize) {
        PageRequestParam pageRequest = new PageRequestParam();
        pageRequest.setPageNumber(pageNumber);
        pageRequest.setPageSize(pageSize);
        return pageRequest;
    }
}
